<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>访客信息</title>
    <base href="<%=basePath%>"><!-- jsp文件头和头部 -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="static/layui/css/layui.css" media="all">
    <style>
        .layui-footer{padding:10px 0;text-align:center;box-shadow:0 -1px 2px 0 rgba(0,0,0,.05)}
    </style>


</head>
<style type="text/css">
    .layui-form-label{
        padding:2px 20px;
        text-align:left;
    }
    .layui-input-block{
        margin-left:20px;
    }
</style>
<body style="background-color:#f7f7f7 ">

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <p>姓名：${pd.vname}</p>
                </div>
<%--                <div class="layui-form-item">--%>
<%--                    <p>事务编号：${pd.id}</p>--%>
<%--                </div>--%>
                <div class="layui-form-item">
                    <p>单位：${pd.vdept}</p>
                </div>
                <div class="layui-form-item">
                    <p>事由：${pd.vtext}</p>
                </div>
<%--                <div class="layui-form-item">--%>
<%--                    <label class="layui-form-label">确认</label>--%>
<%--                    <div class="layui-input-block">--%>
<%--                        <input type="text" name="incheck" lay-verify="required|repass" autocomplete="off" placeholder="请输入已确认" class="layui-input">--%>
<%--                    </div>--%>
<%--                </div>--%>
                <div class="layui-form-item">
                    <div class="layui-footer" style="left: 0;">
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="demo2">确认</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="static/ehome/js/jquery-1.8.3.min.js"></script>
<script src="//g.alicdn.com/dingding/dingtalk-jsapi/2.10.3/dingtalk.open.js"></script>
<script src="static/layui/layui.all.js"></script>

<script>
    layui.use(['form', 'layedit', 'laydate'], function() {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        form.verify({
            repass: function (value) {
                if ($('#incheck').val() != $('已确认').val()) {
                    return '请输入已确认';
                }
            }
        });

        /* 监听按钮 */
        form.on('submit(demo2)', function (data) {
            let indexload = "";

            $.ajax({
                url: '<%=basePath%>visitor/inchecksave.do?id=${pd.id}',
                type: 'post',
                dataType: 'json',
                contentType: "application/json; charset=utf-8",
                cache: false,
                data: JSON.stringify(data),
                beforeSend: function () {
                    indexload = layer.load(1, {
                        shade: [0.1, '#fff']
                    });
                },

                complete: function () {
                    layer.close(indexload);
                },
                success: function (data) {
                    if (data.code == 0) {
                        layer.alert(data.msg, {icon: 6}, function (index) {
                            layer.close(index);
                        });
                    } else {
                        layer.alert(data.msg, {icon: 5}, function (index) {
                            layer.close(index);
                        });
                    }
                }
            });
            return false;
        });
    });

</script>

<script type="text/javascript" >


</script>
</body>
</html>
